<%--
  Created by IntelliJ IDEA.
  User: drophair
  Team: 深藏blow
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>用户信息</title>
    <script src="/js/jquery-3.4.1.min.js"></script>
    <link rel="stylesheet" href="/css/bootstrap.min.css">
</head>
<body>
<div style="text-align: right">
    <%
        String uname = "";
        String uwho = "";
        Cookie[] cookies = request.getCookies();
        for (Cookie cookie : cookies) {
            if (cookie.getName().equals("login_name")) {
                uname = cookie.getValue();
            }
            if (cookie.getName().equals("uwho")) {
                uwho = cookie.getValue();
            }
        }
        if (uname == null || uname.equals("")) {
    %>
    <a style="float: right" href="/register.jsp">注册</a><a href="/login.jsp" style="float: right">登录&nbsp;/&nbsp;</a>
    <%
    } else {
    %>
    <a href="/LogoutServlet" style="float: right">注销</a>
    <%
        if (uwho.equals("0")) {%>
    <a href="/admin/index.jsp">后台</a>
    <%}%>
    <div style="float: right"><%=uname%>，&nbsp;</div>
    <%
        }
    %>
</div>
</body>
</html>
